<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>${category.name}系列</title>
	<script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.js"></script>
	<script src="/layer.js"></script>
</head>
<body>
<a href="/cart">我的购物车</a>
<br>
<#list drinks as drink>
	${drink.id}-${drink.name}-${drink.price} <a id="buy" href="javascript:void(0)" onclick="buy(${drink.id})">加购</a>
	<br>
</#list>

<script>
	function buy(id) {
		$.post("/cart", {id},
			function (data, textStatus, jqXHR) {
				// layer.msg(0);
				if (data.success) {
					layer.msg("加购" + data.drink + "成功");
				}
			},
			"json"
		);
	}
</script>
</body>
</html>